package com.example.bes.springboot.jdbc.war.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

@RestController
public class PropertyController {

    @GetMapping(value = "/properties")
    public Map getAllProperties() {
        Map map = new HashMap();
        Properties systemProperties = System.getProperties();
        for (Object key : systemProperties.keySet()) {
            String propertyName = (String) key;
            String propertyValue = (String) systemProperties.get(propertyName);
            map.put(propertyName, propertyValue);
        }
        return map;
    }
}
